<%-- 
    Document   : viewSubject
    Created on : Nov 5, 2009, 10:00:26 AM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.sql.*,DAO.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%
    Subject sub = new Subject();
    int id = Integer.parseInt(request.getParameter("SubjectID"));
    String SubName = request.getParameter("SubName");
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" media="screen" href="css/admin.css">
        <title>JSP Page</title>

    </head>
    <script language="javascript">
        function backSubject() {
            window.location = "viewSubject.jsp";
        }
    </script>
    <body>
        <fieldset class="textView">
            <br>
            <span class="textSpanTitle" >Sub Subject</span>
            <br>
            <form>
                <table border="1" class="sample" align="center" width="400">
                <tr>
                    <td>
                        <span class="textSpanCheck">Bạn đang chọn : <%=SubName%></span>
                    </td>
                </tr>
            </table>
                <table border="1" width="400" class="sample" align="center">
                    <thead>
                        <tr>
                            <th width="25">ID</th>
                            <th width="150">Sub Subject Name</th>
                            <th width="120">Status</th>
                            <th width="50">Update</th>
                            <th width="50">Delete</th>
                        </tr>
                    </thead>
                    <%
                        int i=0;
                        ResultSet rs = sub.viewSubSubject(id);
                        ResultSet rsNotFound = sub.viewSubSubject(id);
                        while(rs.next()) {
                    %>
                    <tbody>
                        <tr>
                            <td width="25"><%=i%></td>
                            <td width="150"><a href="#"><%=rs.getString("SubName")%></a></td>
                            <td>
                                <%
                            if (rs.getBoolean("Status") == true) {
                        %>
                        <span style="color:red">Đang hoạt động</span>
                        <% } else {
                        %>
                        <span style="color:green">Ngừng họat động </span>
                        <% }%>
                            </td>
                            <td width="50">Edit</td>
                            <td width="50"><a href="deleteSubSubject.jsp?id=<%=rs.getString("SubID")%>&SubjectID=<%=id%>&SubName=<%=SubName%>">Delete</a></td>
                        </tr>
                    </tbody>
                    <%
                        i++;
                        }
                    %>
                </table>
                <table border="1" class="sample" align="center" width="400">
                <tr>
                    <td>
                        <%
                            if(!rsNotFound.next()) {
                        %>
                        <span class="textSpan">Không có bản ghi nào trong Database</span>
                        <%
                            }
                        %>
                    </td>
                </tr>
            </table>
                    <table border="1" class="sample" align="center" width="400">
                <tr>
                    <td>
                        <input type="button" value="Back Subject" class="button" onclick="backSubject()" />
                    </td>
                </tr>
            </table>
            <br>
            </form>
        </fieldset>
    </body>
</html>
